home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 65.zip / BS1 part 65 / Math Visin v2.1 disk 1.adf / Arexx.WB / tutorialexample < prev    next >
Text File  |  1992-02-12  |  3KB  |  128 lines

  1. /* TutorialExample   show what an ARexx program looks like
  2.  
  3.   This is a simple ARexx program to teach you some of the things you
  4. need to know to use ARexx programs with MathVision.  Not a whole lot more to
  5. say.  Just run this program and find out!
  6.  
  7. ==========================================================================*/
  8.  
  9. ADDRESS "MathVision"
  10. OPTIONS RESULTS
  11. NUMERIC DIGITS 14
  12.  
  13. /* sign-on message */
  14. ClrScr = D2C(12)
  15.  
  16. SAY ClrScr "---------------- Tutorial Example ---------------- "
  17. SAY ""
  18. SAY " Welcome to a short tutorial on using ARexx programs with MathVision."
  19. SAY ""
  20. SAY " We are going to look at two topics:"
  21. SAY ""
  22. SAY " 1. How to flip screens"
  23. SAY " 2. How to break out of an ARexx program"
  24. SAY ""
  25. Options Prompt " Press <Return> to Continue "
  26. PULL doit 
  27.  
  28. SAY ClrScr"---------- Flipping Screens ----------"
  29. SAY ""
  30. SAY "   MathVision uses multiples screens.  They are:"
  31. SAY ""
  32. SAY "    - Editing Screen   (Numerical Swamp)"
  33. SAY "    - Plot Screen      (pictures plotted here)"
  34. SAY "    - Workbench Screen (This screen, used for ARexx)"
  35. SAY ""
  36. SAY "   Using multiple screens keeps things from getting"
  37. SAY " jumbled together.  However, you then have to flip between"
  38. SAY " them to get to what you want.  Normally, ARexx programs will"
  39. SAY " handle this for you."
  40. SAY ""
  41. options prompt "Press <Return> to see the Edit and Plot screens "
  42. pull doit
  43.  
  44. EditScreenToFront
  45. call Delay( 700 )
  46. PlotScreenToFront
  47. Say ClrScr
  48. call Delay( 700 )
  49. WorkbenchScreenToFront
  50.  
  51. SAY "   But ARexx does not always flip the screens for you, or it"
  52. SAY " leaves the wrong one in front.  You can flip them easily yourself."
  53. SAY ""
  54. SAY "   To flip the workbench screen to the front or back, hold down"
  55. SAY " the <C=> key to the left of the space bar, and press <N> or <M>."
  56. SAY ""
  57. options prompt " You try it! Then press <Return> to continue "
  58. pull Doit
  59.  
  60. SAY ClrScr"----------------- Breaking Out ----------------- "
  61. SAY ""
  62. SAY "  Sometimes you want to stop a program rather than waiting for"
  63. SAY " it to finish.  This is done by clicking in one of the MathVision"
  64. SAY " screens, holding down the <Ctrl> key, and pressing <ESC>.  This tells"
  65. SAY " cooperating programs that they should stop.  Try this out after"
  66. SAY " pressing return."
  67. SAY ""
  68. SAY " Click, <Ctrl><Esc>"
  69. SAY ""
  70.  
  71. options prompt "Press <Return>, then try it! "
  72. pull doit
  73.  
  74. /*---------------------------- demo simple plot ------------------------- */
  75. StopSign F
  76. Xmin 0
  77. Xmax 10
  78. Ymin "-1"
  79. Ymax 1
  80.  
  81. EraseScreen
  82. OverPlot T
  83.  
  84. SimpleGradient1 F
  85. SimpleGradient2 F
  86. SimplePen 1
  87. SimpleSampleDelta 1
  88. SimpleNoisy T
  89.  
  90. PlotScreenToFront
  91.  
  92. DO t = 1 to 10
  93.   f0 "sin(x)/"t
  94.   PlotSimple
  95.   Get StopSign    /* did user press <ctrl><esc>? */
  96.   StopValue = RESULT
  97.   if (StopValue = "T") then break
  98. END
  99.  
  100. WorkbenchScreenToFront
  101.  
  102. SAY ClrScr
  103. IF (StopValue = "T")
  104.  THEN SAY " Congratulations!  You stopped it!"
  105.  ELSE SAY " Better luck next time!"
  106. SAY ""
  107. SAY " In review, you learned:"
  108. SAY ""
  109. SAY " -Workbench Screen to front: <C=><N>"
  110. SAY " -Workbench Screen to back:  <C=><M>"
  111. SAY " -Stop a MathVision/ARexx program:"
  112. SAY "      Click on  screen, then <Ctrl><ESC>"
  113. SAY ""
  114. options prompt " Click here, then press <RETURN> to exit "
  115.  
  116. pull doit
  117.  
  118. EXIT
  119.  
  120. /*---------------------------- DELAY ------------------------- */
  121. /* I indulge the graciousness of other programs to let me waste */
  122. /* time in a busy wait */
  123.  
  124. DELAY:
  125.   arg times
  126.   do i = 1 to times; end;
  127.   return 0
  128.